import 'package:flutter/material.dart';

import 'UserBean.dart';



class TwoPageRoute extends StatelessWidget {
  const TwoPageRoute(
      {Key? key,
      required this.text, // 接收一个text参数
      required this.userBean //接收一个userBean类
      })
      : super(key: key);


  final String text;
  final UserBean userBean;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("第二个页面"),
      ),
      body: Center(
        child: Column(
          children: [
            Text("接受text值：$text"),
            Text("接受userBean值：${userBean.toString()}"),
            ElevatedButton(
                onPressed: () {
                  Navigator.of(context).pop("这里是返回值");
                },
                child: const Text("返回")
            )
          ],
        ),
      ),
    );
  }
}




class TwoPageRoute2 extends StatelessWidget {

  TwoPageRoute2(
      {Key? key,required this.args})
      : super(key: key);


  final Map args;


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("第二个页面"),
      ),
      body: Center(
        child: Column(
          children: [
            Text("接受text值：${args['text']}"),
            Text("接受userBean值：${args['userBean']}"),
            ElevatedButton(
                onPressed: () {
                  Navigator.of(context).pop("这里是返回值");
                },
                child: const Text("返回")
            )
          ],
        ),
      ),
    );
  }
}
